# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Mathew Meins <mathewm@sdf.lonestar.org>
# Maintainer: Mathew Meins <mathewm@sdf.lonestar.org>
pkgname=uucp
pkgver=1.07
pkgrel=6
pkgdesc="Taylor UUCP is a free implementation of UUCP"
url="https://airs.com/ian/uucp.html"
arch="all"
license="GPL-2.0-or-later"
makedepends="autoconf automake"
subpackages="$pkgname-doc"
options="suid"
pkgusers="uucp"
pkggroups="uucp"
source="https://ftp.gnu.org/gnu/uucp/uucp-$pkgver.tar.gz
	format-strings.patch
	gcc14-configure.patch
	gcc14-socklen_t.patch
	"

prepare() {
	default_prepare

	autoreconf -vif
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-newconfigdir=/etc/uucp \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -m4555 -o uucp -g uucp "$builddir"/uuxqt "$pkgdir"/usr/sbin/uuxqt
	install -m4555 -o uucp -g uucp "$builddir"/uucico "$pkgdir"/usr/sbin/uucico
	install -m4555 -o uucp -g uucp "$builddir"/uux "$pkgdir"/usr/bin/uux
	install -m4555 -o uucp -g uucp "$builddir"/uucp "$pkgdir"/usr/bin/uucp
	install -m4555 -o uucp -g uucp "$builddir"/uuname "$pkgdir"/usr/bin/uuname
	install -m4555 -o uucp -g uucp "$builddir"/cu "$pkgdir"/usr/bin/cu
	install -m4555 -o uucp -g uucp "$builddir"/uustat "$pkgdir"/usr/bin/uustat

	install -m755 -D -o root -g root -d "$pkgdir"/etc/uucp
	install -m755 -D -o uucp -g uucp -d "$pkgdir"/var/spool/uucp
	install -m755 -D -o uucp -g uucp -d "$pkgdir"/var/spool/uucppublic
	install -m755 -D -o uucp -g uucp -d "$pkgdir"/var/log/uucp

	touch "$pkgdir"/etc/uucp/call "$pkgdir"/etc/uucp/dial \
		"$pkgdir"/etc/uucp/dialcode \
		"$pkgdir"/etc/uucp/passwd \
		"$pkgdir"/etc/uucp/port \
		"$pkgdir"/etc/uucp/sys
	chown root:uucp "$pkgdir"/etc/uucp/call \
		"$pkgdir"/etc/uucp/passwd
	chmod 640 "$pkgdir"/etc/uucp/call \
		"$pkgdir"/etc/uucp/passwd
}

sha512sums="
13d215890234e638bed53dce7bab6eb78e0ce6b658f23ac1d7f8abc6e1d97963bef76aa4148ca644f450d5a1678fac940b73fbcd5845d7f5bea3afbd8055229b  uucp-1.07.tar.gz
8b93f4e7708ba2d7830b6b4f3e2994ee56513de0ef406109572b1d550f7e44b3610c3e6b3cb357200976efc75854b9febdb8ea7b4ef7b881483ddcf9e6c5618c  format-strings.patch
2efe9493ca22f36d775179ee4200cff0272f395411f26e894cbb33adfa8ba83c38019b3a1c4da09e01d126e369a850b1d7d0e5919ac7f2fe9ca3b41f9907cd00  gcc14-configure.patch
be528f73613e5dc5cc1ba70224af1d6f6d4d9da446f7ebc4de9a40bec35de7ccacba6bb872de801c8c5961f596586f208722800c1abdee17c104a43d654cd46c  gcc14-socklen_t.patch
"
